package com.xy.farm.activity.deal;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.xy.farm.R;
import com.xy.farm.activity.ImageIntLoader;
import com.xy.farm.activity.base.BaseActivity;
import com.xy.farm.activity.deal.adapter.GoodsDetailsAdapter;
import com.youth.banner.Banner;

import java.util.ArrayList;
import java.util.List;

public class GoodsDetailsActivity extends BaseActivity
{
    private Banner banner;
    private RecyclerView recyclerView;
    private GoodsDetailsAdapter adapter;
    private List<Integer> integerList = new ArrayList<>();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_goods_details);
        findViewById(R.id.btn_back).setOnClickListener(this);
        findViewById(R.id.btn_edit).setOnClickListener(this);
        banner = findViewById(R.id.banner);
        recyclerView = findViewById(R.id.recyclerView);
        integerList.add(R.mipmap.img_goods_details);
        integerList.add(R.mipmap.img_goods_details);
        integerList.add(R.mipmap.img_goods_details);
        banner.setImageLoader(new ImageIntLoader());
        banner.setImages(integerList);
        banner.start();
        LinearLayoutManager manager = new LinearLayoutManager(this)
        {
            @Override
            public boolean canScrollVertically()
            {
                return false;
            }
        };
        recyclerView.setHasFixedSize(true);
        recyclerView.setLayoutManager(manager);
        recyclerView.setAdapter((adapter = new GoodsDetailsAdapter()));
    }

    @Override
    public void onClick(View v)
    {
        super.onClick(v);
        Intent intent;
        switch (v.getId())
        {
            case R.id.btn_edit:
                intent = new Intent(this, ShelvesActivity.class);
                startActivity(intent);
                break;
        }
    }
}
